#ifndef MSGSOCKET_H
#define MSGSOCKET_H

#include <QMap>
#include <QThread>
#include <QTcpSocket>

class MsgSocket : public QObject
{
    Q_OBJECT

public slots:
    void slotReadyRead();
    void slotSendMsg(int index, const QString &msg);

public:
    explicit MsgSocket(QString ipAddr, int port, QObject *parent = nullptr);
    ~MsgSocket();

    void disconnectFromHost();

private:
    QTcpSocket *m_socket;
};

typedef QMap<int, MsgSocket*> MsgSocketMap; //uid, socket*

#endif // MSGSOCKET_H
